package com.ssy.lingxi.settle.accounts.repository;

import com.ssy.lingxi.settle.accounts.entity.InvoiceMessage;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 *发票信息管理
 * @author wrc
 * @date 2020/7/8
 */
@Repository
public interface InvoiceMessageRepository extends JpaRepository<InvoiceMessage, Long>, JpaSpecificationExecutor<InvoiceMessage> {

    List<InvoiceMessage> findAllByMemberIdEquals(Long memberId, Sort sort);


    List<InvoiceMessage> findAllByIsDefaultAndMemberId(Integer isDefault, Long memberId);

    /**
     * 查询会员默认发票
     * @author 伍将
     * @date 2020/10/29
     * @param isDefault: 是否默认：0-否，1-是
     * @param memberId: 会员id
     * @param roleId： 角色id
     * @return com.ssy.lingxi.settle.accounts.entity.InvoiceMessage
     **/
    InvoiceMessage findByIsDefaultAndMemberIdAndCreateRoleId(Integer isDefault, Long memberId, Long roleId);
}
